
#include "SingleList.h"





void testSList1()
{
	SLTNode* pList = NULL;
	SListPushBack(&pList, 1);
	SListPushBack(&pList, 2);
	SListPushBack(&pList, 3);
	SListPushBack(&pList, 4);
	SListPushBack(&pList, 5);

	SListPrint(&pList);

	SListPushFront(&pList, 5);

	SListPrint(&pList);

	//SListPopBack(&pList);
	//SListPopBack(&pList);
	//SListPopBack(&pList);
	//SListPopBack(&pList);
	//SListPopBack(&pList);
	

	SListPopFront(&pList);
	SListPopFront(&pList);


	SListPrint(&pList);
}

void testSList2()
{
	SLTNode* pList = NULL;
	
	SLTNode* pos = SListFind(pList, 5);
	SListInsert(&pList, pos, 5);
	SListInsert(&pList, pos, 2);
	SListInsert(&pList, pos, 3);
	SListPrint(&pList);

	pos = SListFind(pList, 3);
	SlistInsertAfter(pos, 9);
	SListPrint(&pList);

	//SListErase(&pList, pos);

	//pos = SListFind(pList, 2);
	//SListErase(&pList, pos);

	//pos = SListFind(pList, 5);
	//SListErase(&pList, pos);
	//
	//pos = SListFind(pList, 9);
	//SListErase(&pList, pos);
	//SListErase(&pList, pos);

	SListPrint(&pList);

	SListDistroy(&pList);
}



int main()
{
	//testSList1();
	testSList2();

	return 0;
}